package com.vr.xuecheng.feign.fallback;

import com.vr.xuecheng.feign.client.CoursePublishClient;
import lombok.extern.log4j.Log4j2;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

/**
 * @author hzh
 * @date 2025/04/05
 * 查询课程信息熔断处理
 */
@Log4j2
@Component
public class CoursePublishFallbackFactory implements FallbackFactory<CoursePublishClient> {
    @Override
    public CoursePublishClient create(Throwable cause) {
        return courseId -> {
            log.error("调用内容服务，获取课程失败：{}",cause.getMessage());
            return null;
        };
    }
}
